<?php
    $iniVars = parse_ini_file('/home/baanvich/domains/baanvichakorn.com/public_html/config.ini',TRUE);
    include('/home/baanvich/domains/baanvichakorn.com/public_html/classes/adodb5/adodb.inc.php');
    include('/home/baanvich/domains/baanvichakorn.com/public_html/function/db.func.php');
    
    $sql = "SELECT * FROM ads ORDER BY ads_id";
    $result = $db->Execute($sql);
    while (!$result->EOF)
    {
        if($result->fields['ads_img']!='' AND file_exists($iniVars['Locations']['sitepath'].$result->fields['ads_img'])){
            $dataImg[$result->fields['ads_id']] = '<a href="'.'http://'.str_replace('http://','',$result->fields['ads_url']).'"><img src="'.$iniVars['Locations']['siteurl'].$result->fields['ads_img'].'" class="adsimg" /></a>';
	    $dataText[$result->fields['ads_id']] = nl2br($result->fields['ads_text']);
        }else{
            $dataImg[$result->fields['ads_id']] = '';
			$dataText[$result->fields['ads_id']] = '';
        }
		
	if($result->fields['ads_id']==7){
		$dataText[$result->fields['ads_id']] = $result->fields['ads_text'];
	}
	$result->MoveNext();
    }
    $result->Close();

    $adstable = <<<adstable
            <table id="ads">
                <tr>
                    <td class="ads_img">
                        {$dataImg[1]}
                        <p>{$dataText[1]}</p>
                    </td>
                    <td class="ads_img">
                        {$dataImg[2]}
                        <p>{$dataText[2]}</p>
                    </td>
                    <td class="ads_img">
                        {$dataImg[3]}
                        <p>{$dataText[3]}</p>
                    </td>
                </tr>
                <tr>
                    <td colspan="3" class="ads_center_msg">
                        กรุณาเลือกรูปแบบการเรียนพิเศษ<br />
                ที่เหมาะกับน้องๆค่ะ
                    </td>
                </tr>
                <tr>
                    <td class="ads_img">
                        {$dataImg[4]}
                        <p>{$dataText[4]}</p>
                    </td>
                    <td class="ads_img">
                        {$dataImg[5]}
                        <p>{$dataText[5]}</p>
                    <td class="ads_img">
                        {$dataImg[6]}
                        <p>{$dataText[6]}</p>
                    </td>
                </tr>
                <tr>
                    <td colspan="3" class="ads_bottom_msg">
                        {$dataText[7]}
                    </td>
                </tr>
            </table>
adstable;
?>
<!-- intro page -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>โรงเรียนกวดวิชาบ้านวิชากร</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="Content-Style-Type" content="text/css" />
        <meta name="distribution" content="Thailand" />
        <meta http-equiv="content-language" content="th" />
        
        <link rel="stylesheet" href="../css/reset.css" type="text/css" />
        <link rel="stylesheet" href="../css/intro.css" type="text/css" />
        <link rel="stylesheet" href="style.css" type="text/css" />
        
        <link rel="shortcut icon" href="/2008/site/images/favicon.ico" type="image/x-icon" />
        
        <!--[if IE 6]>
	    <link href="borringIE6.css" rel="stylesheet" />
	<![endif]-->
	<!--[if IE 7]>
	    <link href="borringIE7.css" rel="stylesheet" />
	<![endif]-->
	<!--[if IE 8]>
	    <<link href="borringIE8.css" rel="stylesheet" />
	<![endif]-->
        
        <meta name="copyright" content="&copy; 2010 นวัตพล ยศกำธร, http://www.nawattapon.com" />
        <meta name="author" content="นวัตพล ยศกำธร" />
        
    </head>
    <body>
        <div id="intro_wrap">
            <?php echo $adstable; ?>
        </div>
    </body>
</html>
